import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {ServiceTypeLabel, ServiceTypeLabelPageResult, ServiceTypeLabelQuery} from "@/api/service-type-label/types";

/**
 * 服务类型分页列表
 *
 * @param queryParams
 */
export function listServiceLabelPages(
  queryParams: ServiceTypeLabelQuery
): AxiosPromise<ServiceTypeLabelPageResult> {
  return request({
    url: '/web/casualServiceLabel/pages',
    method: 'get',
    params: queryParams,
  });
}

export function serviceLabelAdd(data: any): AxiosPromise<ServiceTypeLabelPageResult> {
  return request({
    url: '/web/casualServiceLabel/add',
    method: 'post',
    data: data,
  });
}

export function serviceLabelUpdate(data: ServiceTypeLabel): AxiosPromise<any> {
  return request({
    url: '/web/casualServiceLabel/edit',
    method: 'post',
    data: data,
  });
}

export function getServiceLabelForm(id: number): AxiosPromise<ServiceTypeLabel> {
  return request({
    url: '/web/casualServiceLabel/queryById',
    method: 'get',
    params: {id: id}
  });
}

export function serviceLabelDelete(id: number): AxiosPromise<ServiceTypeLabel> {
  return request({
    url: '/web/casualServiceLabel/del',
    method: 'get',
    params: {id: id}
  });
}

export function listServiceTypeLabelOptions(typeId: number): AxiosPromise<OptionType[]> {
  return request({
    url: '/web/casualServiceLabel/getByIdOption',
    method: 'get',
    params: {typeId: typeId}
  });
}
